package day12;

/**
 * String s = new String(“hello”)和String s = “hello”;的区别
 * 
 * ==:比较引用类型，比较的是地址值
 * equal():默认比较的是地址值。String类重写了equals()方法，该方法的作用是比较字符串的内容是否相同
 */
public class StringDemo2 {
    public static void main(String[] args) {
        String s = "hel ";
        s += "wor";
        System.out.println(s);

        String s1 = new String("he");
        String s2 = "he";
        System.out.println(s1 == s2);
        System.out.println(s1.equals(s2));

        String s3 = "bb";
        String s4 = "bb";
        System.out.println(s3 == s4);
        System.out.println(s3.equals(s4));

        

    }
}
